<!DOCTYPE html>
<html>
<head>
    

    

    



    <meta charset="utf-8">
    
    
    
    
    <title>Nginx主要应用 - 负载均衡 | Sean&#39;s Blog | why so serious ?</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    
    <meta name="theme-color" content="#3F51B5">
    
    
    <meta name="keywords" content="负载均衡">
    <meta name="description" content="概述 将用户输入的 http 网址请求分发到集群中不同的机器上, 这就是负载均衡要做的事情 负载均衡通常是指将请求 ‘均匀’ 分推到集群中多个服务器节点上进行执行, 这里的均匀是指在一个比较大的统计范围内是基本均匀的, 并不是完全均匀  实现方式硬件负载均衡 比如 : F5 &#x2F; 深信服 &#x2F; Array等 优点 : 有厂商专业的技术服务团队提供支持, 性能稳定 缺点 : 费用昂贵, 对于规模较小的网">
<meta property="og:type" content="article">
<meta property="og:title" content="Nginx主要应用 - 负载均衡">
<meta property="og:url" content="http://www.some-note.cn/2020/06/29/Nginx%E4%B8%BB%E8%A6%81%E5%BA%94%E7%94%A8-%E8%B4%9F%E8%BD%BD%E5%9D%87%E8%A1%A1/index.html">
<meta property="og:site_name" content="Sean&#39;s Blog">
<meta property="og:description" content="概述 将用户输入的 http 网址请求分发到集群中不同的机器上, 这就是负载均衡要做的事情 负载均衡通常是指将请求 ‘均匀’ 分推到集群中多个服务器节点上进行执行, 这里的均匀是指在一个比较大的统计范围内是基本均匀的, 并不是完全均匀  实现方式硬件负载均衡 比如 : F5 &#x2F; 深信服 &#x2F; Array等 优点 : 有厂商专业的技术服务团队提供支持, 性能稳定 缺点 : 费用昂贵, 对于规模较小的网">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="http://www.some-note.cn/images/Nginx%E8%B4%9F%E8%BD%BD%E7%AE%80%E6%98%93%E5%9B%BE.png">
<meta property="article:published_time" content="2020-06-29T07:41:35.000Z">
<meta property="article:modified_time" content="2020-08-26T02:10:46.375Z">
<meta property="article:author" content="Sean">
<meta property="article:tag" content="负载均衡">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="http://www.some-note.cn/images/Nginx%E8%B4%9F%E8%BD%BD%E7%AE%80%E6%98%93%E5%9B%BE.png">
    
        <link rel="alternate" type="application/atom+xml" title="Sean&#39;s Blog" href="/atom.xml">
    
    <link rel="shortcut icon" href="/favicon.ico">
    <link rel="stylesheet" href="//unpkg.com/hexo-theme-material-indigo@latest/css/style.css">
    <script>window.lazyScripts=[]</script>

    <!-- custom head -->
    

<meta name="generator" content="Hexo 4.2.1"></head>

<body>
    <div id="loading" class="active"></div>

    <aside id="menu" class="hide" >
  <div class="inner flex-row-vertical">
    <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menu-off">
        <i class="icon icon-lg icon-close"></i>
    </a>
    <div class="brand-wrap" style="background-image:url(/img/brand.jpg)">
      <div class="brand">
        <a href="/" class="avatar waves-effect waves-circle waves-light">
          <img src="/img/avatar.jpg">
        </a>
        <hgroup class="introduce">
          <h5 class="nickname">Sean</h5>
          <a href="mailto:inoubliable_s@163.com" title="inoubliable_s@163.com" class="mail">inoubliable_s@163.com</a>
        </hgroup>
      </div>
    </div>
    <div class="scroll-wrap flex-col">
      <ul class="nav">
        
            <li class="waves-block waves-effect">
              <a href="/"  >
                <i class="icon icon-lg icon-home"></i>
                主页
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/archives"  >
                <i class="icon icon-lg icon-archives"></i>
                归档
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/tags"  >
                <i class="icon icon-lg icon-tags"></i>
                标签
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/categories"  >
                <i class="icon icon-lg icon-th-list"></i>
                分类
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://github.com/Sean-inoubliable" target="_blank" >
                <i class="icon icon-lg icon-github"></i>
                Github
              </a>
            </li>
        
      </ul>
    </div>
  </div>
</aside>

    <main id="main">
        <header class="top-header" id="header">
    <div class="flex-row">
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light on" id="menu-toggle">
          <i class="icon icon-lg icon-navicon"></i>
        </a>
        <div class="flex-col header-title ellipsis">Nginx主要应用 - 负载均衡</div>
        
        <div class="search-wrap" id="search-wrap">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="back">
                <i class="icon icon-lg icon-chevron-left"></i>
            </a>
            <input type="text" id="key" class="search-input" autocomplete="off" placeholder="输入感兴趣的关键字">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="search">
                <i class="icon icon-lg icon-search"></i>
            </a>
        </div>
        
        
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menuShare">
            <i class="icon icon-lg icon-share-alt"></i>
        </a>
        
    </div>
</header>
<header class="content-header post-header">

    <div class="container fade-scale">
        <h1 class="title">Nginx主要应用 - 负载均衡</h1>
        <h5 class="subtitle">
            
                <time datetime="2020-06-29T07:41:35.000Z" itemprop="datePublished" class="page-time">
  2020-06-29
</time>


	<ul class="article-category-list"><li class="article-category-list-item"><a class="article-category-list-link" href="/categories/Nginx/">Nginx</a></li></ul>

            
        </h5>
    </div>

    


</header>


<div class="container body-wrap">
    
    <aside class="post-widget">
        <nav class="post-toc-wrap post-toc-shrink" id="post-toc">
            <h4>TOC</h4>
            <ol class="post-toc"><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#概述"><span class="post-toc-number">1.</span> <span class="post-toc-text">概述</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#实现方式"><span class="post-toc-number">2.</span> <span class="post-toc-text">实现方式</span></a><ol class="post-toc-child"><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#硬件负载均衡"><span class="post-toc-number">2.1.</span> <span class="post-toc-text">硬件负载均衡</span></a></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#软件负载均衡"><span class="post-toc-number">2.2.</span> <span class="post-toc-text">软件负载均衡</span></a></li></ol></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#Nginx负载均衡"><span class="post-toc-number">3.</span> <span class="post-toc-text">Nginx负载均衡</span></a><ol class="post-toc-child"><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#如何实现"><span class="post-toc-number">3.1.</span> <span class="post-toc-text">如何实现</span></a></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#配置"><span class="post-toc-number">3.2.</span> <span class="post-toc-text">配置</span></a><ol class="post-toc-child"><li class="post-toc-item post-toc-level-4"><a class="post-toc-link" href="#1-在-http-模块添加-例"><span class="post-toc-number">3.2.1.</span> <span class="post-toc-text">1. 在 http 模块添加 ( 例 )</span></a></li><li class="post-toc-item post-toc-level-4"><a class="post-toc-link" href="#2-在server模块里添加-例"><span class="post-toc-number">3.2.2.</span> <span class="post-toc-text">2. 在server模块里添加 ( 例 )</span></a></li></ol></li></ol></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#Nginx常用负载均衡策略"><span class="post-toc-number">4.</span> <span class="post-toc-text">Nginx常用负载均衡策略</span></a><ol class="post-toc-child"><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#1-轮询"><span class="post-toc-number">4.1.</span> <span class="post-toc-text">1. 轮询</span></a></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#2-权重"><span class="post-toc-number">4.2.</span> <span class="post-toc-text">2. 权重</span></a></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#3-ip-hash"><span class="post-toc-number">4.3.</span> <span class="post-toc-text">3. ip_hash</span></a><ol class="post-toc-child"><li class="post-toc-item post-toc-level-4"><a class="post-toc-link" href="#存在问题"><span class="post-toc-number">4.3.1.</span> <span class="post-toc-text">存在问题</span></a></li></ol></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#4-最少链接"><span class="post-toc-number">4.4.</span> <span class="post-toc-text">4. 最少链接</span></a></li></ol></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#负载均衡其他几个配置"><span class="post-toc-number">5.</span> <span class="post-toc-text">负载均衡其他几个配置</span></a></li></ol>
        </nav>
    </aside>


<article id="post-Nginx主要应用-负载均衡"
  class="post-article article-type-post fade" itemprop="blogPost">

    <div class="post-card">
        <h1 class="post-card-title">Nginx主要应用 - 负载均衡</h1>
        <div class="post-meta">
            <time class="post-time" title="2020-06-29 15:41:35" datetime="2020-06-29T07:41:35.000Z"  itemprop="datePublished">2020-06-29</time>

            
	<ul class="article-category-list"><li class="article-category-list-item"><a class="article-category-list-link" href="/categories/Nginx/">Nginx</a></li></ul>



            

        </div>
        <div class="post-content" id="post-content" itemprop="postContent">
            <h2 id="概述"><a href="#概述" class="headerlink" title="概述"></a>概述</h2><ul>
<li>将用户输入的 http 网址请求分发到集群中不同的机器上, 这就是负载均衡要做的事情</li>
<li>负载均衡通常是指将请求 ‘均匀’ 分推到集群中多个服务器节点上进行执行, 这里的均匀是指在一个比较大的统计范围内是基本均匀的, 并不是完全均匀</li>
</ul>
<h2 id="实现方式"><a href="#实现方式" class="headerlink" title="实现方式"></a>实现方式</h2><h3 id="硬件负载均衡"><a href="#硬件负载均衡" class="headerlink" title="硬件负载均衡"></a>硬件负载均衡</h3><ul>
<li>比如 : F5 / 深信服 / Array等</li>
<li>优点 : 有厂商专业的技术服务团队提供支持, 性能稳定</li>
<li>缺点 : 费用昂贵, 对于规模较小的网络应用成本太高</li>
</ul>
<h3 id="软件负载均衡"><a href="#软件负载均衡" class="headerlink" title="软件负载均衡"></a>软件负载均衡</h3><ul>
<li>比如 : Nginx / LVS / HAProxy等</li>
<li>优点 : 免费开源, 成本低廉</li>
</ul>
<h2 id="Nginx负载均衡"><a href="#Nginx负载均衡" class="headerlink" title="Nginx负载均衡"></a>Nginx负载均衡</h2><h3 id="如何实现"><a href="#如何实现" class="headerlink" title="如何实现"></a>如何实现</h3><blockquote>
<p>通过在 Nginx 的 nginx.conf 文件进行 <strong>配置</strong> 即可实现</p>
</blockquote>
<ul>
<li>下为Nginx负载简易图<figure class="image-bubble">
                <div class="img-lightbox">
                    <div class="overlay"></div>
                    <img src="/images/Nginx负载简易图.png" alt="" title="">
                </div>
                <div class="image-caption"></div>
            </figure>

</li>
</ul>
<h3 id="配置"><a href="#配置" class="headerlink" title="配置"></a>配置</h3><h4 id="1-在-http-模块添加-例"><a href="#1-在-http-模块添加-例" class="headerlink" title="1. 在 http 模块添加 ( 例 )"></a>1. 在 http 模块添加 ( 例 )</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"># upstream 的名字, 一般定为域名</span><br><span class="line">upstream www.sean.com &#123; </span><br><span class="line">#对应 Tomcat 的 IP &amp; Port</span><br><span class="line">    server 127.0.0.1:9100 weight&#x3D;3; </span><br><span class="line">#有几个 Tomcat, 就配几个 server</span><br><span class="line">    server 127.0.0.1:9200 weight&#x3D;1; </span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<blockquote>
<ul>
<li>其中 <strong>weight</strong> 表示权重, 用于后端服务器性能不均的情况, 访问比率约等于权重之比, 权重越大访问机会越多</li>
<li><strong>upstream</strong> 是配置 <strong>Nginx</strong> 与后端服务器负载均衡非常重要的一个模块. 并且它还能对后端服务器的健康状况进行检查, 若后端服务器中的一台发生故障, 则前端的请求不会转发到该故障的机器</li>
</ul>
</blockquote>
<h4 id="2-在server模块里添加-例"><a href="#2-在server模块里添加-例" class="headerlink" title="2. 在server模块里添加 ( 例 )"></a>2. 在server模块里添加 ( 例 )</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"># www.sean.com字符串要与upstream后面的字符串相等</span><br><span class="line">location &#x2F;sean &#123; # 项目路径</span><br><span class="line">    proxy_pass http:&#x2F;&#x2F;www.sean.com; # 代理转发</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h2 id="Nginx常用负载均衡策略"><a href="#Nginx常用负载均衡策略" class="headerlink" title="Nginx常用负载均衡策略"></a>Nginx常用负载均衡策略</h2><blockquote>
<p><strong>轮询(默认)</strong> / <strong>权重</strong> / <strong>ip_hash</strong> / <strong>最少链接</strong></p>
</blockquote>
<h3 id="1-轮询"><a href="#1-轮询" class="headerlink" title="1. 轮询"></a>1. 轮询</h3><blockquote>
<p>每个请求轮流分配到不同的后端服务器, 如果后端服务器down掉, 将自动剔除</p>
</blockquote>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"># 无 weight</span><br><span class="line">upstream sean &#123;</span><br><span class="line">    server 127.0.0.1:8080;</span><br><span class="line">    server 127.0.0.1:9090;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="2-权重"><a href="#2-权重" class="headerlink" title="2. 权重"></a>2. 权重</h3><blockquote>
<p>每个请求按一定比例分发到不同的服务器, <strong>weight</strong> 值越大 访问的比例越大, 用于后端服务器性能不均的情况</p>
</blockquote>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"># 有 weight</span><br><span class="line">upstream sean &#123;</span><br><span class="line">    server 192.168.0.14 weight&#x3D;5;</span><br><span class="line">    server 192.168.0.15 weight&#x3D;2;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="3-ip-hash"><a href="#3-ip-hash" class="headerlink" title="3. ip_hash"></a>3. ip_hash</h3><blockquote>
<p>也叫 IP 绑定, 每个请求按访问 <strong>IP的hash值</strong> 分配, 这样每个访问 客户端都会固定访问一个后端服务器, 可以解决 <strong>会话session</strong> 丢失的问题</p>
</blockquote>
<ul>
<li>使用源地址哈希算法, 将同一客户端的请求总是发往同一后端服务器, 除非该服务器不可用</li>
<li>类似 : hash(“124.207.55.82”) % 2 = ?  (0 | 1)</li>
</ul>
<h4 id="存在问题"><a href="#存在问题" class="headerlink" title="存在问题"></a>存在问题</h4><blockquote>
<ul>
<li>当后端服务器宕机, session会丢失; </li>
<li>来自同一局域网的客户端会被转发到同一后端服务器, 可能导致负载失衡; </li>
<li>不适用于 CDN 网络</li>
</ul>
</blockquote>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">upstream sean &#123;</span><br><span class="line">    ip_hash;</span><br><span class="line">    server 127.0.0.1:8080;</span><br><span class="line">    server 127.0.0.1:9090;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="4-最少链接"><a href="#4-最少链接" class="headerlink" title="4. 最少链接"></a>4. 最少链接</h3><blockquote>
<p>Web请求会被转发到连接数最少的服务器上</p>
</blockquote>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">upstream sean &#123;</span><br><span class="line">    least_conn;</span><br><span class="line">    server 127.0.0.1:8080;</span><br><span class="line">    server 127.0.0.1:9090;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h2 id="负载均衡其他几个配置"><a href="#负载均衡其他几个配置" class="headerlink" title="负载均衡其他几个配置"></a>负载均衡其他几个配置</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"># 其他所有非 backup 机器 down 机的时候, 才会请求 backup 机器, 俗称 &#39;备胎&#39;</span><br><span class="line"># backup 可用在上线期间更新产品 , reload</span><br><span class="line">upstream sean &#123;</span><br><span class="line">    server 127.0.0.1:9100;</span><br><span class="line">    server 127.0.0.1:9200 backup;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"># down 表示当前的 server 是 down 状态, 不参与负载均衡</span><br><span class="line">upstream sean &#123;</span><br><span class="line">    server 127.0.0.1:9100;</span><br><span class="line">    server 127.0.0.1:9200 down;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
        </div>

        <blockquote class="post-copyright">
    
    <div class="content">
        
<span class="post-time">
    最后更新时间：<time datetime="2020-08-26T02:10:46.375Z" itemprop="dateUpdated">2020-08-26 10:10:46</time>
</span><br>


        
        这里可以写作者留言，标签和 hexo 中所有变量及辅助函数等均可调用，示例：<a href="/2020/06/29/Nginx%E4%B8%BB%E8%A6%81%E5%BA%94%E7%94%A8-%E8%B4%9F%E8%BD%BD%E5%9D%87%E8%A1%A1/" target="_blank" rel="external">http://www.some-note.cn/2020/06/29/Nginx%E4%B8%BB%E8%A6%81%E5%BA%94%E7%94%A8-%E8%B4%9F%E8%BD%BD%E5%9D%87%E8%A1%A1/</a>
        
    </div>
    
    <footer>
        <a href="http://www.some-note.cn">
            <img src="/img/avatar.jpg" alt="Sean">
            Sean
        </a>
    </footer>
</blockquote>

        
<div class="page-reward">
    <a id="rewardBtn" href="javascript:;" class="page-reward-btn waves-effect waves-circle waves-light">赏</a>
</div>



        <div class="post-footer">
            
	<ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E8%B4%9F%E8%BD%BD%E5%9D%87%E8%A1%A1/" rel="tag">负载均衡</a></li></ul>


            
<div class="page-share-wrap">
    

<div class="page-share" id="pageShare">
    <ul class="reset share-icons">
      <li>
        <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=http://www.some-note.cn/2020/06/29/Nginx%E4%B8%BB%E8%A6%81%E5%BA%94%E7%94%A8-%E8%B4%9F%E8%BD%BD%E5%9D%87%E8%A1%A1/&title=《Nginx主要应用 - 负载均衡》 — Sean's Blog&pic=http://www.some-note.cn/img/avatar.jpg" data-title="微博">
          <i class="icon icon-weibo"></i>
        </a>
      </li>
      <li>
        <a class="weixin share-sns wxFab" href="javascript:;" data-title="微信">
          <i class="icon icon-weixin"></i>
        </a>
      </li>
      <li>
        <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=http://www.some-note.cn/2020/06/29/Nginx%E4%B8%BB%E8%A6%81%E5%BA%94%E7%94%A8-%E8%B4%9F%E8%BD%BD%E5%9D%87%E8%A1%A1/&title=《Nginx主要应用 - 负载均衡》 — Sean's Blog&source=何必那么认真" data-title=" QQ">
          <i class="icon icon-qq"></i>
        </a>
      </li>
      <li>
        <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=http://www.some-note.cn/2020/06/29/Nginx%E4%B8%BB%E8%A6%81%E5%BA%94%E7%94%A8-%E8%B4%9F%E8%BD%BD%E5%9D%87%E8%A1%A1/" data-title=" Facebook">
          <i class="icon icon-facebook"></i>
        </a>
      </li>
      <li>
        <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=《Nginx主要应用 - 负载均衡》 — Sean's Blog&url=http://www.some-note.cn/2020/06/29/Nginx%E4%B8%BB%E8%A6%81%E5%BA%94%E7%94%A8-%E8%B4%9F%E8%BD%BD%E5%9D%87%E8%A1%A1/&via=http://www.some-note.cn" data-title=" Twitter">
          <i class="icon icon-twitter"></i>
        </a>
      </li>
      <li>
        <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=http://www.some-note.cn/2020/06/29/Nginx%E4%B8%BB%E8%A6%81%E5%BA%94%E7%94%A8-%E8%B4%9F%E8%BD%BD%E5%9D%87%E8%A1%A1/" data-title=" Google+">
          <i class="icon icon-google-plus"></i>
        </a>
      </li>
    </ul>
 </div>



    <a href="javascript:;" id="shareFab" class="page-share-fab waves-effect waves-circle">
        <i class="icon icon-share-alt icon-lg"></i>
    </a>
</div>



        </div>
    </div>

    
<nav class="post-nav flex-row flex-justify-between">
  
    <div class="waves-block waves-effect prev">
      <a href="/2020/06/30/Nginx%E4%B8%BB%E8%A6%81%E5%BA%94%E7%94%A8-%E9%9D%99%E6%80%81%E4%BB%A3%E7%90%86/" id="post-prev" class="post-nav-link">
        <div class="tips"><i class="icon icon-angle-left icon-lg icon-pr"></i> Prev</div>
        <h4 class="title">Nginx主要应用 - 静态代理</h4>
      </a>
    </div>
  

  
    <div class="waves-block waves-effect next">
      <a href="/2020/06/22/Nginx%E4%B8%BB%E8%A6%81%E5%BA%94%E7%94%A8-%E9%9D%99%E6%80%81%E7%BD%91%E7%AB%99/" id="post-next" class="post-nav-link">
        <div class="tips">Next <i class="icon icon-angle-right icon-lg icon-pl"></i></div>
        <h4 class="title">Nginx主要应用 - 静态网站</h4>
      </a>
    </div>
  
</nav>



    




















</article>

<div id="reward" class="page-modal reward-lay">
    <a class="close" href="javascript:;"><i class="icon icon-close"></i></a>
    <h3 class="reward-title">
        <i class="icon icon-quote-left"></i>
        喝杯咖啡
        <i class="icon icon-quote-right"></i>
    </h3>
    <div class="reward-content">
        
        <div class="reward-code">
            <img id="rewardCode" src="/img/wechat.jpg" alt="打赏二维码">
        </div>
        
        <label class="reward-toggle">
            <input id="rewardToggle" type="checkbox" class="reward-toggle-check"
                data-wechat="/img/wechat.jpg" data-alipay="/img/alipay.jpg">
            <div class="reward-toggle-ctrol">
                <span class="reward-toggle-item wechat">微信</span>
                <span class="reward-toggle-label"></span>
                <span class="reward-toggle-item alipay">支付宝</span>
            </div>
        </label>
        
    </div>
</div>



</div>

        <footer class="footer">
    <div class="top">
        

        <p>
            
                <span><a href="/atom.xml" target="_blank" class="rss" title="rss"><i class="icon icon-lg icon-rss"></i></a></span>
            
            <span>博客内容遵循 <a rel="license noopener" href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh" target="_blank">知识共享 署名 - 非商业性 - 相同方式共享 4.0 国际协议</a></span>
        </p>
    </div>
    <div class="bottom">
        <p><span>Sean &copy; 2020</span>
            <span>
                
                Power by <a href="http://hexo.io/" target="_blank">Hexo</a> Theme <a href="https://github.com/yscoder/hexo-theme-indigo" target="_blank">indigo</a>
            </span>
        </p>
    </div>
</footer>

    </main>
    <div class="mask" id="mask"></div>
<a href="javascript:;" id="gotop" class="waves-effect waves-circle waves-light"><span class="icon icon-lg icon-chevron-up"></span></a>



<div class="global-share" id="globalShare">
    <ul class="reset share-icons">
      <li>
        <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=http://www.some-note.cn/2020/06/29/Nginx%E4%B8%BB%E8%A6%81%E5%BA%94%E7%94%A8-%E8%B4%9F%E8%BD%BD%E5%9D%87%E8%A1%A1/&title=《Nginx主要应用 - 负载均衡》 — Sean's Blog&pic=http://www.some-note.cn/img/avatar.jpg" data-title="微博">
          <i class="icon icon-weibo"></i>
        </a>
      </li>
      <li>
        <a class="weixin share-sns wxFab" href="javascript:;" data-title="微信">
          <i class="icon icon-weixin"></i>
        </a>
      </li>
      <li>
        <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=http://www.some-note.cn/2020/06/29/Nginx%E4%B8%BB%E8%A6%81%E5%BA%94%E7%94%A8-%E8%B4%9F%E8%BD%BD%E5%9D%87%E8%A1%A1/&title=《Nginx主要应用 - 负载均衡》 — Sean's Blog&source=何必那么认真" data-title=" QQ">
          <i class="icon icon-qq"></i>
        </a>
      </li>
      <li>
        <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=http://www.some-note.cn/2020/06/29/Nginx%E4%B8%BB%E8%A6%81%E5%BA%94%E7%94%A8-%E8%B4%9F%E8%BD%BD%E5%9D%87%E8%A1%A1/" data-title=" Facebook">
          <i class="icon icon-facebook"></i>
        </a>
      </li>
      <li>
        <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=《Nginx主要应用 - 负载均衡》 — Sean's Blog&url=http://www.some-note.cn/2020/06/29/Nginx%E4%B8%BB%E8%A6%81%E5%BA%94%E7%94%A8-%E8%B4%9F%E8%BD%BD%E5%9D%87%E8%A1%A1/&via=http://www.some-note.cn" data-title=" Twitter">
          <i class="icon icon-twitter"></i>
        </a>
      </li>
      <li>
        <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=http://www.some-note.cn/2020/06/29/Nginx%E4%B8%BB%E8%A6%81%E5%BA%94%E7%94%A8-%E8%B4%9F%E8%BD%BD%E5%9D%87%E8%A1%A1/" data-title=" Google+">
          <i class="icon icon-google-plus"></i>
        </a>
      </li>
    </ul>
 </div>


<div class="page-modal wx-share" id="wxShare">
    <a class="close" href="javascript:;"><i class="icon icon-close"></i></a>
    <p>扫一扫，分享到微信</p>
    <img src="//api.qrserver.com/v1/create-qr-code/?data=http://www.some-note.cn/2020/06/29/Nginx%E4%B8%BB%E8%A6%81%E5%BA%94%E7%94%A8-%E8%B4%9F%E8%BD%BD%E5%9D%87%E8%A1%A1/" alt="微信分享二维码">
</div>




    <script src="//cdn.bootcss.com/node-waves/0.7.4/waves.min.js"></script>
<script>
var BLOG = { ROOT: '/', SHARE: true, REWARD: true };


</script>

<script src="//unpkg.com/hexo-theme-material-indigo@latest/js/main.min.js"></script>


<div class="search-panel" id="search-panel">
    <ul class="search-result" id="search-result"></ul>
</div>
<template id="search-tpl">
<li class="item">
    <a href="{path}" class="waves-block waves-effect">
        <div class="title ellipsis" title="{title}">{title}</div>
        <div class="flex-row flex-middle">
            <div class="tags ellipsis">
                {tags}
            </div>
            <time class="flex-col time">{date}</time>
        </div>
    </a>
</li>
</template>

<script src="//unpkg.com/hexo-theme-material-indigo@latest/js/search.min.js" async></script>








<script>
(function() {
    var OriginTitile = document.title, titleTime;
    document.addEventListener('visibilitychange', function() {
        if (document.hidden) {
            document.title = '死鬼去哪里了！';
            clearTimeout(titleTime);
        } else {
            document.title = '(つェ⊂)咦!又好了!';
            titleTime = setTimeout(function() {
                document.title = OriginTitile;
            },2000);
        }
    });
})();
</script>



</body>
</html>
